package org.huawei260.TiKu.ODsuanfa;

import java.util.Arrays;
import java.util.Scanner;
public class B_2023B_4200__前缀和阿里巴巴找黄金宝箱1 {

//	public class Main {
		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);

			int[] arr = Arrays.stream(sc.nextLine().split(",")).mapToInt(Integer::parseInt).toArray();

			System.out.println(getResult(arr));
		}

		public static int getResult(int[] arr) {
			int leftSum = 0;
			int rightSum = Arrays.stream(arr).sum() - arr[0];

			if (leftSum == rightSum) return 0;

			for (int i = 1; i < arr.length; i++) {
				leftSum += arr[i - 1];
				rightSum -= arr[i];
				if (leftSum == rightSum) return i;
			}

			return -1;
		}
	}